<?php
class Solicitudes_Form_InstrumentoAutoevaluacion extends Form_Base{
	
		
	public function __construct($options = null) {
		parent::__construct($options);
	}
	
	public function init() {
		$domConfig = Zend_Registry::get('domConfig');
		$appConfig = Zend_Registry::get('appConfig');
		
		$this->setName('item_instrumento');
		$this->setMethod("post");
		//$this->setEnctype('multipart/form-data');
		
		$array_elements[] = new Zend_Form_Element_Hidden("codinstrumento");
		$array_elements[] = new Zend_Form_Element_Hidden("totalpoblacion");
		$array_elements[] = new Zend_Form_Element_Hidden("muestrasugerida");
		
		$element = new Zend_Form_Element_Select('codlista');
		$element->setLabel("Encuesta: ");
		$element->setRegisterInArrayValidator(false);
		$element->addMultiOption(null, "-- Seleccione --");
		//$element->addMultiOptions($domConfig->TIPOINSTRUMENTO->toArray());
        //$element->setRequired(true);
        $element->addValidator('digits');
		//$element->setOptions(array('onChange'=>'ver_ocultar_tipo(this);'));
		$array_elements[] = $element;
		
		
		$element = new Zend_Form_Element_Text('nombre');
		$element->setLabel('Nombre :');
		$element->setRequired(true);
		$element->addFilter('StripTags');
		$element->addFilter('StringTrim');
//		$element->addFilter('StringToUpper');
		$array_elements[] = $element;

		$element = new Zend_Form_Element_Textarea('descripcion');
		$element->setLabel('Descripción :');
		$element->setRequired(true);
		$element->addFilter('StripTags');
		$element->addFilter('StringTrim');
		$element->setAttrib("rows",3);
		$element->addValidator('StringLength', false, array($domConfig->TEXTO_TAMANOMIN, $domConfig->TEXTO_TAMANOMAX));
		$array_elements[] = $element;
		
		$element = new Zend_Form_Element_Submit ( 'btnSubmit' );
		$element->setLabel("Guardar");
		$params=App_Util_SafeUrl::encriptar(array("opcion"=>3),true);
		$element->setDescription($this->createCommandLink("Cancelar", "solicitudes/detalleautoevaluacion/metodologia/{$params}"));
		$array_elements[] = $element;
		
		$this->addElements($array_elements);
		
		$this->loadTableDecorators();
		$this->loadViewScriptDecorators();
	}
	
	public function loadViewScriptDecorators() {
		$this->setDecorators ( array (array ('viewScript', array ('viewScript' => 'viewscripts/instrumento_form.phtml' ) ) ) );
	}
}